home *** CD-ROM | disk | FTP | other *** search
/ MaxiMac 2000 December / MaxiMac 109.iso / Macworld on CD n°109 / Applications (Mac OS X PB) / MacOSX ScreenSavers / Source Code / Sproingees / SproingeeView.m < prev    next >
Encoding:
Text File  |  2000-08-17  |  995 b   |  66 lines  |  [????/????]

  1. #import "SproingeeView.h"
  2.  
  3. @implementation SproingeeView
  4.  
  5. - (id)initWithFrame:(NSRect)frameRect
  6. {
  7.     self = [super initWithFrame:frameRect];
  8.     if (self) {
  9.         _view = [[NSOpenGLView alloc] initWithFrame:frameRect];
  10.         [self addSubview:_view];
  11.     }
  12.  
  13.     return self;
  14. }
  15.  
  16. - (NSTimeInterval)animationTimeInterval
  17. {
  18.     return 0.01;
  19. }
  20.  
  21. - (void)setFrameSize:(NSSize)newSize
  22. {
  23.     [super setFrameSize:newSize];
  24.     [_view setFrameSize:newSize];
  25.     _initedGL = NO;
  26.  
  27. }
  28.  
  29. - (void)drawRect:(NSRect)rects
  30. {
  31.     
  32.     [_view lockFocus];
  33.     
  34.     if (!_initedGL) {
  35.         init_sproingies();
  36.             reshape_sproingies((int)rects.size.width, (int)rects.size.height);
  37.  
  38.         _initedGL = YES;
  39.     }
  40.  
  41.     [_view unlockFocus];
  42. }
  43.  
  44.  
  45. - (void)oneStep
  46. {
  47.     [_view lockFocus];
  48.  
  49.     draw_sproingies();
  50.     [_view unlockFocus];
  51.  
  52.     
  53.     return;
  54. }
  55.  
  56.  
  57. - (BOOL)hasConfigureSheet { return NO; }
  58. - (NSWindow*)configureSheet { return nil; }
  59.  
  60. - (void)closeSheet:(id)sender
  61. {
  62.     [NSApp endSheet:nil];
  63. }
  64.  
  65. @end
  66.